﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EasyGrocer
{
    public partial class Flyer : System.Web.UI.Page
    {
        private string page = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            page = Request.QueryString.Get("page");
            if (page == null || page == "" || page == "1")
            {
                img.ImageUrl = "~/images/flyerPg1.JPG";
                pageNo.Text = "Page 1 of 3";
                Next.Enabled = true;
                Prev.Enabled = false;
            }
            else if (page == "2")
            {
                img.ImageUrl = "~/images/flyerPg2.JPG";
                pageNo.Text = "Page 2 of 3";
                Next.Enabled = true;
                Prev.Enabled = true;
            }
            else if (page == "3")
            {
                img.ImageUrl = "~/images/flyerPg3.JPG";
                pageNo.Text = "Page 3 of 3";
                Next.Enabled = false;
                Prev.Enabled = true;
            }
        }

        protected void Next_Click(object sender, EventArgs e)
        {
            if (page == "" || page == "1")
            {
                Response.Redirect("Flyer.aspx?page=2");
            }
            else if (page == "2")
            {
                Response.Redirect("Flyer.aspx?page=3");
            }
            else
            {
                Response.Redirect("Flyer.aspx?page=2");
            }
        }

        protected void Prev_Click(object sender, EventArgs e)
        {
            if (page == "2")
            {
                Response.Redirect("Flyer.aspx?page=1");
            }
            else if (page == "3")
            {
                Response.Redirect("Flyer.aspx?page=2");
            }
        }

        protected void img_Click(object sender, ImageMapEventArgs e)
        {
            Response.Redirect("ProductPage.aspx");
        }
    }
}
